/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package net.wofly.sale.shoppingcart.repository;


import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import net.wofly.sale.shoppingcart.entity.CartList;

/**
 * @author siqingwei
 */
public interface CartListRepository
		extends PagingAndSortingRepository<CartList, String>, JpaSpecificationExecutor<CartList> {

	List<CartList> findByShoppingCartIDAndCommodity_CommodityID(String userID, String commodityID);
	
	List<CartList> findByShoppingCartIDAndShoppingCartTypeAndCommodity_CommodityID(String userID, Integer shoppingCartType, String commodityID);

	List<CartList> findByShoppingCartIDOrderByModifyDate(String shoppingCartID);
	
	List<CartList> findByShoppingCartIDAndShoppingCartTypeOrderByModifyDate(String shoppingCartID ,Integer shoppingCartType);
	
	void  deleteByShoppingCartID(String shoppingCartID);
	
	void  deleteByShoppingCartIDAndShoppingCartType(String shoppingCartID, Integer shoppingCartType);

}